Skip to content

chore(opencode): retry a failed test twice so CI stops failing on runner speed - #75

Merged
goleary merged 1 commit into
devfrom
ci-test-retry
Nov 13, 2026
Merged

goleary merged 1 commit into
devfrom
ci-test-retry

Conversation

@goleary

@goleary goleary commented Nov 13, 2026 •

Copy link
Copy Markdown

Makes the fork's tests retry a failure twice before failing, so a PR stops going red on tests that only lost a race with the clock.

Symptom

The test job in fork-ci fails on unchanged code. On 2026-11-13, dev at 235aa91 passed once and failed once, and #74 at one commit failed three times and then passed. Earlier examples: dev on Sep 27 and Oct 15, cutoff-step-retry on Oct 14.

Four different tests account for those failures, and none of them failed on a wrong result:

  • opencode run (non-interactive subprocess): a spawned CLI did not finish inside its 30-second budget (expected exit 0, got -1 after 30280ms, stderr Error: Timed out). The tests in that file run concurrently, so several CLI processes boot at once.
  • configured chunkTimeout raises a retryable response stream error when SSE body stalls: a 50 ms timeout has to fire before a 250 ms response body, and did not.
  • session.processor effect tests mark pending tools as aborted on cleanup: interrupted after 21 seconds.

Cause

These tests depend on wall-clock time, and GitHub-hosted runners vary. The Test packages/opencode step takes 354–545 seconds on passing runs and 493–758 seconds on failing ones, with each test file starting about 1.5× later from the first minute of a slow run.

Fix

packages/opencode/bunfig.toml sets retry = 2 for bun test. Bun retries a failing test up to twice; a test that fails three times in a row still fails.

It is set in the package's config file, so it applies to bun test on a laptop as well as in CI. A CI-only version would be a --retry=2 flag in fork-ci.yml; that needs a GitHub token with the workflow scope to push, which the one used here does not have.

Not done here: widening each test's time budget, or running the subprocess tests one at a time. Those remove the cause for the tests we know about, but there are at least four of them across three files, and the next one would fail the same way.

Trade-off

A test that genuinely fails one time in three now passes, locally and in CI. That is the cost of not having every PR depend on runner speed.

Tests

Checked in packages/opencode with bun 1.3.14 through bun run test: a test written to fail on its first run and pass on its second now passes, and a test that always fails still fails after its third attempt. This PR's own fork-ci run is the check on the hosted runners.

🤖 Generated with Claude Code


Devin Review


Summary by cubic

Fixes flaky CI failures in packages/opencode tests that race wall-clock time on slow GitHub-hosted runners.

Sets retry = 2 in packages/opencode/bunfig.toml so bun test retries a failing test twice before giving up. Several tests depend on timing (a 30-second budget for a spawned CLI, a 50ms stream timeout) and lose the race on loaded runners, failing unchanged code. A test that fails three times in a row still fails.

Written for commit c7428fc. Summary will update on new commits.

View guided diff Turn on auto-fix

Several tests race a real clock and fail on a slow CI runner, on
unchanged code. Retrying keeps a PR from going red on runner speed.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown

The following comment was made by an LLM, it may be inaccurate:

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 PR lacks an issue reference

The description links prior PR #74, but no issue. The repository requires every PR to reference an existing issue; check for a GitHub-linked issue outside the description.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

View guided diff | Turn on auto-fix | Re-trigger cubic

@goleary
goleary merged commit d201e75 into dev Nov 13, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant